<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title>补货提醒 - 仓库管理系统</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">

<div class="layui-body" style="padding:15px;top: 0px;">

    <!-- start sp-wrapper -->
    <link rel="stylesheet" href="/sb/stock.css"/>
    <div class="sp-wrapper">
        <h2 class="sp-title">
            <span>补货提醒（抖店）</span>
            <div class="layui-inline">
                <button type="button" lass="button" id="print_btn" class="layui-btn layui-btn-primary">打印页面</button>
            </div>
            <div class="layui-inline">
                <button type="button" lass="button" id="export_btn" class="layui-btn layui-btn-primary">导出数据</button>
            </div>
        </h2>

        <div class="sp-table" id="myElementId">

            <table>
                <thead>
                <tr>
                    <th>序号</th>
                    <th>款号</th>
                    <th>SKU</th>
                    <th>商品</th>
                    <th>规格</th>
                    <th>供应商</th>
                    <th>库存总数</th>
                    <th>抖店-待发货总数</th>
                    <th>库存结余</th>

                </tr>
                </thead>
                <tbody id="sp-data">
                <tr th:each="item:${list}" >
                    <td th:text="${itemStat.index + 1}"></td>
                    <td th:text="${item.goodsNumber}"></td>
                    <td th:text="${item.code}">2019-03-15</td>
                    <td >
                        <img th:src="${item.colorImage}" width="50px" height="50px" />
                    </td>
                    <td th:text="${item.specDesc}"></td>
                    <td ></td>
                    <td th:text="${item.qty}">0</td>
                    <td th:text="${item.total}">0</td>
                   <td>
                   <span th:style="${item.qty - item.total > 5 } ? '' : 'color:red' " th:text="${item.qty - item.total }"></span>
                   </td>
                </tr>

                </tbody>
            </table>

        </div>
        <div class="pages">
            <paging:pager th:value="${pageIndex}" th:rows="${totalSize}" th:size="${pageSize}"/>
        </div>
    </div>

    <script type="text/javascript" src="/sb/jquery.min.js"></script>
    <script type="text/javascript" src="/sb/Tips.min.js"></script>
    <script src="/jQuery.print.min.js"></script>


    <script type="text/javascript">
        $(function () {
            $("#print_btn").click(function () {
                $.print("#myElementId" /*, options*/);
            })
            $('#export_btn').click(function () {
                window.location.href = "/purchase/bu_huo_ti_xing_export_dy";
            });
        });
    </script>

    <!-- end sp-wrapper -->
    <script>
        layui.use(['laydate', 'layer'], function () {
            var laydate = layui.laydate;
            var layer = layui.layer;
            //执行一个laydate实例
            laydate.render({
                elem: '.startDate' //指定元素
            });
            laydate.render({
                elem: '.endDate' //指定元素
            });


            $(".print").click(function () {
                var id = $(this).attr("data-id");
                console.log(id);
                //iframe层

                layer.open({
                    type: 2,
                    title: '打印采购单',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['940px', '90%'],
                    content: '/purchase/detail?id=' + id //iframe的url
                });
            })

        });
    </script>
</div>
</body>
<html>
